﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.
	Private mi As myInfo
	Private lblmyyue As Label
	Private pid As payItem
	Private pc As PayCls
	Private payyue As Panel
	Private lblpricetopay As Label
	Private Label1 As Label
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("layselectpaymethod")
	initdata
End Sub
Private Sub initdata
	comm.setFA(btnleft,"fa-angle-left","")
	mi=g_store.get("myinfo")
	pid=g_store.get("pid")
	payyue.Visible=Not(pid.noinpay)
	pc.Initialize(Activity)
	comm.setViewWrapContent(Label1)
	lblmyyue.Left=Label1.Width+Label1.Left+5dip
	lblmyyue.Text=$"(余额￥$1.2{mi.yue}元)"$

	comm.setFA(lblpricetopay,"fa-rmb",$"$1.2{pid.money}"$)
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
'余额支付
Sub payyue_Click
	If mi.yue>pid.money Then
		If IsNumber(pid.money) And pid.money=0 Then '如果要支付的金额是0就不要密码
			pc.subpay(pid.pid,"test",0)
		Else
			'钱够
			'暂时屏蔽支付密码功能
			pc.subpay(pid.pid,"123456",0)
'			Dim inp As InputDialog
'			inp.PasswordMode=True
'			If inp.Show("请输入支付密码(如果没有支付密码请在个人资料中先设置好才能使用余额支付)","支付","确定","取消","",Null)=DialogResponse.POSITIVE And inp.Input.Trim.Length>0 Then
'				pc.subpay(pid.pid,inp.Input.Trim,0)
'			End If
		End If
	Else
		'钱不够
		comm.TL("余额不足请充值后支付或者选择其他支付方式")
	End If
End Sub
'Sub JobDone(thj As HttpJob)
'	ProgressDialogHide
'	If thj.Success Then
'		Dim str As String=thj.GetString
'		Dim nr As netRes=ParseHelper.getStatusData(str)
'		comm.L(str)
'		Select thj.JobName
'		Case "subpay"
'			If nr.nCode=200 Then
'				comm.TL("支付成功")
'				Activity.Finish
'			Else
'				comm.TL("错误:"&nr.sData)
'			End If
'		End Select
'	Else
'		comm.TL("网络错误:"&thj.JobName&thj.ErrorMessage)
'	End If
'	thj.Release
'End Sub

''第三方支付
'Sub payoth_Click
'	comm.TL("尚未开放")
'End Sub
Sub ivback_Click
	Activity.Finish
End Sub

Sub alipay_Click
	If pid.noinpay Then
		'充值
		pc.subcharge(pid,1)
	Else
		pc.subpay(pid.pid,"",1)
	End If
	
End Sub

Sub wx_Click
	If pid.noinpay Then
		'充值
		pc.subcharge(pid,2)
	Else
		pc.subpay(pid.pid,"",2)
	End If
'	pc.subpay(pid.pid,"",2)
End Sub